using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class BuildData
{
    public BuildType buildType;
    public List<NeedResourceData> needResourceDatas = new List<NeedResourceData>();
    public Image Build_Lvse;
    public GameObject BuildRoot;
    public bool IsBuilding = false; //是否正在建造中，以这个标记位来防止重复建造
    public bool IsBuild; //是否已经建造完毕

    public float GetLvseFillAmound()
    {
        int AllNeedResourceCount = 0;
        int CurrentHaveResourceCount = 0;
        foreach (var needResourceData in needResourceDatas)
        {
            AllNeedResourceCount += needResourceData.NeedResourceCount;
            CurrentHaveResourceCount += needResourceData.CurrentResourceCount;
        }
        if (AllNeedResourceCount == 0)
        {
            return 0;
        }
        return (float)CurrentHaveResourceCount / AllNeedResourceCount;
    }

}
